AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")
require("datastream")

function ENT:Initialize()
	self.Entity:SetModel("models/props_combine/combine_interface001a.mdl")
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_NONE)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self:SetUseType(SIMPLE_USE)
	
	local phys = self.Entity:GetPhysicsObject()
	self.nodupe = true
	self.ShareGravgun = true

	if phys and phys:IsValid() then phys:Wake() end
	self:SetCollisionGroup(COLLISION_GROUP_WORLD) 
end

function ENT:KeyValue( key, value )
	if(key == "TeamOwner")then
		self.TeamNumber = value
	end
end

function ENT:Use(activator,caller)
	if(tonumber(self.TeamNumber) == 3 || activator:Team() == tonumber(self.TeamNumber) )then
		datastream.StreamToClients(activator, "ShopMenu", { ["weapons"] = GAMEMODE:GiveTable(ShopWeapons), ["ammo"] = GAMEMODE:GiveTable(ShopAmmo)})
	end
end 